'use strict';
module.exports = app => {
    const {INTEGER, STRING} = app.Sequelize;

    const User = app.model.define('User', {
            id: {
                type: INTEGER,
                autoIncrement: true,
                primaryKey: true,
            },
            user: {
                type: STRING(100),
                allowNull: false,
            },
        },
        {
            freezeTableName: true,
            tableName: 'user',
            timestamps: false,
        }
    );

    User.find = async function (id) {
        const user = await this.findOne({
            where: {
                id: id
            }
        });
        return user || {}
    };


    return User;
};